********************************************************************************
* appendix figure 2: infutor selection

********************************************************************************

clear all 
set more off

* load infutor data at tract level
use "tract_pop_narc_2017", clear
rename pop_2017 narc_pop
rename tract GEOID

* merge to census tract population
merge 1:1 GEOID using "$root/verification_data/all_tracts_2017"
keep if _merge==3 & narc_pop != 0
drop _merge

* create ratio variable
gen narc_ratio=narc_pop/pop_over_25

* create graphs
lab var narc_ratio "Infutor observations/Census population"
lab var pct_college "Percent college educated"
lab var pct_white "Percent white"
lab var med_hh_inc "Median household income"
lab var pct_poverty "Percent poverty"

sum narc_ratio, d
local lb = r(p1)
local ub = r(p99)

foreach var of varlist pct_college pct_white med_hh_inc pct_poverty {

	sum `var', d
	local vlb = r(p5)
	local vub = r(p95)		
	

	lpoly narc_ratio `var' if inrange(narc_ratio, `lb', `ub') & (`var' > `vlb' & `var' < `vub'), nosc ///
		ylabel(.5(0.1)1) graphregion(color(white)) title("")

}



